package com.yangjun.common.enums.report;

import java.util.List;
import java.util.Map;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

public enum AnalysisTypeEnum {
	orderMain("订单主表","orderMain"),orderDetail("订单明细","orderDetail");
	
	private String name;
	private String value;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getValue() {
		return value;
	}
	public void setValue(String value) {
		this.value = value;
	}
	private AnalysisTypeEnum(String name, String value) {
		this.name = name;
		this.value = value;
	}
	
	public static List<Map<String,Object>> getAnalysisTypeMap(List<String>  orderAnalysisList){
		List<Map<String,Object>> resultList = Lists.newArrayList();
		for(AnalysisTypeEnum analysisTypeEnum : AnalysisTypeEnum.values()){
			String name = analysisTypeEnum.getName();
			String value = analysisTypeEnum.getValue();
			if(orderAnalysisList.contains(value)){
				Map<String,Object> item = Maps.newHashMap();
				item.put("name", name);
				item.put("value", value);
				item.put("selected", true);
				resultList.add(item);
			}
		}
		if(resultList.size()>1){
			resultList.get(1).put("selected", false);
		}
		return resultList ; 
	}
}
